<?php

class Application_Model_Parents extends Zend_Db_Table_Abstract
{
    protected $_name = "Parents";
    protected $_primary = "Parent_Id";
    protected $db;

    public function  __construct() {
        parent::__construct();
        $this->db=Zend_Registry::get('db');
    }

    public function listStu()
    {
        $sql = $this->db->query("select count(*) from Parents");
        return $sql->fetchAll();
    }
    public function countParentsPerStudent($studentid)
    {
        $sql = $this->db->query("select count(*) as parentsPerStudent from Parents inner join Students where Parents.id = Students.id and Students.id=".$studentid);
        $rows = $sql->fetchAll();
        return $rows[0]['parentsPerStudent'];
    }
}

